import React from 'react';
import MyDrawer from './MyDrawer';
import MyAppBar from './MyAppBar';
/**
 * 系统大体框架
 */
class MyFrame extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: true
    };
    this.drawer = React.createRef();//创建侧边栏的引用
  }
  /**
   * 打开侧边栏
   * 
   */
  openDrawer = () => {
    this.setState({
      isOpen: true
    });
    this.drawer.current.handleDrawerOpen();
    console.log('open');
  }

  closeDrawer = () => {
    this.setState({
      isOpen: false
    });
    console.log('close');
  }


  render() {
    return (
      <div>
        <MyAppBar
          title="成绩管理系统" 
          //avatar='https://i.loli.net/2020/04/04/ab5jgULczuOM9n3.jpg'
          //username='杜瑾'
          style={{ zIndex: 1 }}
          callback={this.openDrawer}
        />
        <div>
          <MyDrawer ref={this.drawer} callback={this.closeDrawer} isOpen={this.state.isOpen} style={{ zIndex: -1 }} /> s
        </div>
      </div>
    );
  }
}

export default MyFrame;